// document.addEventListener("click",function(){
//     alert("Hello");
// });
var ul=document.getElementById("ul");
ul.onclick=function(e){
    var s=this.children;
    for(var i=0;i<s.length;i++){
        s[i].style.backgroundColor='';
    }
    e.target.style.backgroundColor='red';
}

document.querySelector(".div1").onclick=function(e){
    alert("div1");
    console.log(e.eventPhase);
    e.stopPropagation();
}
function fn(e){
    switch(e.type){
        case 'click':
            console.log("这是一个点击事件")
            break;
        case 'mouseout':
            console.log('这是鼠标移出事件');
            break;
        case 'mouseover':
            console.log('这是鼠标悬浮事件');
    }
}
var box1=document.getElementById('box1');
box1.onclick=fn;
box1.onmouseout=fn;
box1.onmouseover=fn;